home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / dev / lang / pcq12b.lzh / Include / Utils / CRT.i < prev    next >
Text File  |  1991-04-05  |  3KB  |  171 lines

  1. {
  2.     CRT.i for PCQ Pascal
  3.  
  4.     These routines are a simple attempt to mimic the some of the
  5.     Turbo Pascal CRT routines.  See ConsoleTest.p for an example of 
  6.     using these.
  7.     Note that ConsoleSetPtr, the actual type returned by
  8.     AttachConsole, is not defined here.  I wanted to implement it as sort
  9.     of an opaque type.
  10.     The source for these routines is under Runtime/Extras, in
  11.     CRT.p and CRT2.p.
  12. }
  13.  
  14. {$I "Include:Intuition/Intuition.i"}
  15.  
  16.  
  17.  
  18. {
  19.     Initialize the CRT routines for a particular window.  This routine
  20.     returns Nil if there is a problem, or a pointer to a record that
  21.     stores the important information the rest of the routines require.
  22.  
  23.     AttachConsole must be called before any of the other routines.
  24. }
  25.  
  26. Function AttachConsole(w : WindowPtr) : Address;
  27.     External;
  28.  
  29.  
  30. {
  31.     Clear from the cursor position to the end of the line
  32. }
  33.  
  34. Procedure ClrEOL(CRT : Address);
  35.     External;
  36.  
  37.  
  38. {
  39.     Clear the text area of the window, and moves the cursor to 1,1
  40. }
  41.  
  42. Procedure ClrScr(CRT : Address);
  43.     External;
  44.  
  45.  
  46. {
  47.     Turn the console device's text cursor off.  Note that this is not
  48.     the same as the mouse pointer.
  49. }
  50.  
  51. Procedure CursOff(CRT : Address);
  52.     External;
  53.  
  54.  
  55. {
  56.     Turn the text cursor on
  57. }
  58.  
  59. Procedure CursOn(CRT : Address);
  60.     External;
  61.  
  62.  
  63.  
  64. {
  65.     Close the console device and free any memory allocated by the
  66.     AttachConsole call.  Also, take care of any pending console IO.
  67.     This routine must be called before the program terminates, and
  68.     before the window is closed.
  69. }
  70.  
  71. Procedure DetachConsole(CRT : Address);
  72.     External;
  73.  
  74.  
  75. {
  76.     Move the text cursor to the specified column and row X,Y.
  77. }
  78.  
  79. Procedure GotoXY(CRT : Address; x,y : Short);
  80.     External;
  81.  
  82.  
  83.  
  84. {
  85.     Insert a line at the current cursor position.  The current line
  86.     and all those below it are moved down one.
  87. }
  88.  
  89. Procedure InsLine(CRT : Address);
  90.     External;
  91.  
  92.  
  93.  
  94. {
  95.     Returns TRUE if there is a key waiting at the console
  96. }
  97.  
  98. Function KeyPressed(CRT : Address) : Boolean;
  99.     External;
  100.  
  101.  
  102. {
  103.     Return the maximum character column for the window
  104. }
  105.  
  106. Function MaxX(CRT : Address) : Short;
  107.     External;
  108.  
  109. {
  110.     Return the maximum character row for the window
  111. }
  112.  
  113. Function MaxY(CRT : Address) : Short;
  114.     External;
  115.  
  116.  
  117.  
  118. {
  119.     Wait for a key to be pressed, and return it.  CRT is a pointer to
  120.     the CRT record returned by AttachConsole.  Note that the key will
  121.     not automatically be displayed - you'll have to call WriteString
  122.     or something.
  123. }
  124.  
  125. Function ReadKey(CRT : Address) : Char;
  126.     External;
  127.  
  128.  
  129. {
  130.     Set the foreground (text) pen number.  The actual color displayed
  131.     depends on the color map in use for the screen, so you'll have
  132.     to use SetRGB4 calls (or the equivalent) to get particular values.
  133. }
  134.  
  135. Procedure TextColor(CRT : Address; t : Byte);
  136.     External;
  137.  
  138.  
  139.  
  140. {
  141.     Set the background color for the text.
  142. }
  143.  
  144. Procedure TextBackground(CRT : Address; t : Byte);
  145.     External;
  146.  
  147. {
  148.     Return the current text cursor column
  149. }
  150.  
  151. Function WhereX(CRT : Address) : Short;
  152.     External;
  153.  
  154. {
  155.     Return the current text cursor row
  156. }
  157.  
  158. Function WhereY(CRT : Address) : Short;
  159.     External;
  160.  
  161.  
  162.  
  163. {
  164.     Write a string to the window through the console device.  The
  165.     string can contain ANSI codes to change the pen colors, move
  166.     the cursor, just about anything.
  167. }
  168.  
  169. Procedure WriteString(CRT : Address; Str : String);
  170.     External;
  171.